package cn.iocoder.yudao.module.resource.dal.mysql.interactionlog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.resource.controller.admin.interactionlog.vo.InteractionLogPageReqVO;
import cn.iocoder.yudao.module.resource.dal.dataobject.interactionlog.InteractionLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 交互日志 Mapper
 *
 * @author lizhongwen
 */
@Mapper
public interface InteractionLogMapper extends BaseMapperX<InteractionLogDO> {

    default PageResult<InteractionLogDO> selectPage(InteractionLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InteractionLogDO>()
                .eqIfPresent(InteractionLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(InteractionLogDO::getGameMatchId, reqVO.getGameMatchId())
                .eqIfPresent(InteractionLogDO::getWsSessionId, reqVO.getWsSessionId())
                .eqIfPresent(InteractionLogDO::getTraceId, reqVO.getTraceId())
                .likeIfPresent(InteractionLogDO::getContent, reqVO.getContent())
                .betweenIfPresent(InteractionLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InteractionLogDO::getLogId));
    }

}